package com.kumz.SpringMVC.service.Impl;

import com.kumz.SpringMVC.mapper.UserMapper;
import com.kumz.SpringMVC.pojo.User;
import com.kumz.SpringMVC.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Author: Yunz
 * E-mail: 1603754314@qq.com
 * Date: 2022/12/12
 */
@Service
public class UserServiceImpl  implements UserService {
    //注入userMapper
    @Autowired
    private UserMapper userMapper;
    //通过User的用户账号和用户密码查询用户信息
    @Override
    public User login(User user) {
        return userMapper.login(user);
    }

    @Override
    public int addUser(User user) {
        return userMapper.addUser(user);
    }

    @Override
    public int deleteUserByName(int id) {
        return userMapper.deleteUserByName(id);
    }

    @Override
    public int updateUser(User user) {
        return userMapper.updateUser(user);
    }

    @Override
    public User selectUserById(int id) {
        return userMapper.selectUserById(id);
    }

    @Override
    public List<User> selectAllUser() {
        return userMapper.selectAllUser();
    }

    @Override
    public User selectUserByName(String username) {
        return userMapper.selectUserByName(username);
    }

}
